package com.rediss.rediss;

import com.rediss.rediss.utils.RedisOperator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 蔡翔
 * @Date: 2020/4/5 19:52
 * @Version 1.0
 */
@RestController
public class redisTest {
    @Autowired
    RedisTemplate redisTemplate;

    @Autowired
    RedisOperator redisOperator;

    @PostMapping("/set")
    public void set(String key,String value){
        redisOperator.set(key,value);
    }

    @PostMapping("/get")
    public String get(String key){

        return redisOperator.get(key);
    }

    @PostMapping("/del")
    public Object del(String key){
        redisOperator.del(key);
        return "ok";
    }
}
